<?php
declare (strict_types = 1);

namespace app\admin\controller;

use think\facade\Db;
use think\facade\View;

class shuxing
{

    public function shuxing()
    {

        $rt=Db::table('ecm_goods_prop')->select()->toArray();


        if(empty($rt)){
            var_dump($rt);
        }else{
            foreach($rt as $k=>$v){
                $shuxing=Db::table('ecm_goods_prop_value')
                    ->field('pid,prop_value')
                    ->where("vid in ({$v['pvalues']})")
                    ->select();
                $arr=[];
                foreach($shuxing as $kk=>$vv){
                    $arr[]=$vv['prop_value'];
                    $a=implode(',',$arr);
                }
                $v['a']=$a;
                $rt[$k]['b']=$a;
                View::assign('arr',$arr);
            }
            View::assign('list',$rt);
        }
        return  View::fetch();
    }

}
//class GoodsProp
//{
//    public function goods_prop()
//    {
//        $rt=Db::table('ecm_goods_prop')->select();
//
//
//        if($rt->isEmpty()){
//            var_dump($rt->isEmpty());
//        }else{
//            foreach($rt as $v){
//                $shuxing=Db::table('ecm_goods_prop_value')->field('pid,prop_value')->where("vid in ({$v['pvalues']})")->select();
//                $arr=[];
//                foreach($shuxing as $vv){
//                    $arr[]=$vv['prop_value'];
//                    $a=implode(',',$arr);
//                    View::assign('a',$a);
//                }
//                View::assign('arr',$arr);
//
//            }
//            $rt->toArray();
//            View::assign('list',$rt);
//        }
//        return  View::fetch();
//    }
//}